#include "NoSmoke.h"

NoSmoke g_pNoSmoke;

void NoSmoke::Init()
{
	Active = true;
	g_pSmokeStack	  = g_pInterfaces.g_pMaterialSystem->FindMaterial("SmokeStack", "ClientEffect textures", true, NULL);
	g_pSmokeParticle  = g_pInterfaces.g_pMaterialSystem->FindMaterial("particle/particle_smokegrenade", "ClientEffect textures", true, NULL);
	g_pSmokeParticle1 = g_pInterfaces.g_pMaterialSystem->FindMaterial("particle/particle_smokegrenade1", "ClientEffect textures", true, NULL);
	g_pScreenSpaceFog = g_pInterfaces.g_pMaterialSystem->FindMaterial("particle/screenspace_fog", "ClientEffect textures", true, NULL);
}

void NoSmoke::SetActive(bool bActive)
{
	Active = bActive;
}

void NoSmoke::Enable()
{
	Active = true;
}

void NoSmoke::Disable()
{
	Active = false;
}

void NoSmoke::Compute()
{
	if(Active)
	{
		g_pSmokeStack->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
		g_pSmokeParticle->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
		g_pSmokeParticle1->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
		g_pScreenSpaceFog->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
	}
	else
	{
		g_pSmokeStack->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, false);
		g_pSmokeParticle->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, false);
		g_pSmokeParticle1->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, false);
		g_pScreenSpaceFog->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, false);
	}
}